<?php
class Tag2vol extends Model{
	protected $table_name = 'tag2vol';
	
	public function test(){
		echo 'Tag model test!<br/>';
	}
	
	////记录对应关系->计数
	public function add_tag2vol($tag_id,$vol_id){
		if(empty($tag_id)|| empty($vol_id)) return 0;
		obj('Tag')->inr($tag_id);
		return $this->insert(array('tag_id'=>$tag_id,'vol_id'=>$vol_id));
	}
	
		
	//记录对应关系
	public function add_tags2vol($tags,$vol_id) {
		$ids = obj('Tag')->add_tags($tags);
		foreach($ids as $id) {
			if(empty($id)) continue;
			$this->add_tag2vol($id,$vol_id);
		}
	}
	
	
	
	
}
?>